import request from "@/utils/request";
import { AxiosPromise } from "axios";

/**
 * 抖音结算单数据
 *
 * @param queryParams
 */
export function getDyBillPage(queryParams) {
	return request({
		url: '/api/v1/dyBill/page',
		method: 'get',
		params: queryParams
	});
}


/**
 * 获取抖音结算单表单数据
 *
 * @param queryParams
 */
export function getDyBillForm(id: number){
	return request({
		url: '/api/v1/dyBill/' + id + '/form',
		method: 'get'
	});
}

/**
 * 保存抖音结算单
 *
 * @param data
 */
export function saveDyBill(data) {
	return request({
		url: "/api/v1/dyBill",
		method: "post",
		data: data,
	});
}

/**
 * 删除抖音结算单
 *
 * @param ids
 */
export function deleteDyBill(ids: string) {
	return request({
		url: '/api/v1/dyBill/' + ids,
		method: 'delete'
	});
}

/**
 * 导入抖音结算单
 *
 * @param storeCode
 * @param file
 */
export function importDyBill(storeCode, file: any) {
	const formData = new FormData();
	formData.append('file', file);
	return request({
		url: '/api/v1/dyBill/dyBillImport/'+storeCode,
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data'
		}
	});
}

/**
 * 导出抖音结算单
 *
 * @param ids
 * @returns
 */
export function exportDyBill(ids: any) {
	return request({
		url: '/api/v1/dyBill/_export?ids='+ids,
		method: 'get',
		responseType: 'arraybuffer'
	});
}

export function getBillColumnPage(queryParams) {

}
export function downloadTemplateApi(queryParams) {

}
export function importBillColumn(queryParams) {

}
